package fr.xelaprod.open.source.android.rss.graphicsElements;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import fr.xelaprod.open.source.android.rss.R;
import fr.xelaprod.open.source.android.rss.db.MyNewsHandleBDD;

public class DoubleChoicePopUpInsertNews extends DoubleChoicePopUp{

    public DoubleChoicePopUpInsertNews(Activity activity,String title,
    		String message,String buttonOk,String buttonCancel,
    		MyNewsHandleBDD myNews,final String text)
    {
    	super.news=myNews;
		new AlertDialog.Builder(activity)
        .setIcon(android.R.drawable.ic_dialog_alert)
        .setTitle(title)
        .setMessage(message)
        .setIcon(R.drawable.world)
        .setPositiveButton(buttonOk, new DialogInterface.OnClickListener() {
	           public void onClick(DialogInterface dialog, int id) {
	        	   news.open();
	        	   news.insertItem(text);
	        	   news.close();
	           }
	        })
        .setNegativeButton(buttonCancel, new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();
           }
        })
        .show();
    }

}
